package Test1230;

public class Test17 {
    public static void main(String[] args) {

        // (17)
        // 定义实现m方法：在arr中找出指定元素的下标、如果没有元素、则返回-1
        int a = 2;
        int[] arr = {1,2,3,4,5};
        int b = m(arr, a);
        System.out.println(b);

    }
    public static int m(int[] arr, int a) {
        for (int i = 0; i < arr.length; i++){
            if (arr[i] == a){
                return i;
            }

        }return -1;

    }
}